﻿using System;
using System.Collections.Generic;

namespace Utility
{
	// Token: 0x02000401 RID: 1025
	public abstract class StateManagerBase<T_ID, T_CLASS> where T_CLASS : StateBase
	{
		// Token: 0x0600198D RID: 6541 RVA: 0x000A501C File Offset: 0x000A321C
		public StateManagerBase()
		{
		}

		// Token: 0x17000272 RID: 626
		// (get) Token: 0x0600198E RID: 6542 RVA: 0x000A5030 File Offset: 0x000A3230
		public T_ID NowStateID
		{
			get
			{
				return this.nowStateID;
			}
		}

		// Token: 0x0600198F RID: 6543 RVA: 0x000A5038 File Offset: 0x000A3238
		public void Main()
		{
			this.nowStateClass.Main();
		}

		// Token: 0x06001990 RID: 6544 RVA: 0x000A504C File Offset: 0x000A324C
		public void SetState(T_ID t_id, T_CLASS t_class)
		{
			this.states.Add(t_id, t_class);
		}

		// Token: 0x06001991 RID: 6545 RVA: 0x000A505C File Offset: 0x000A325C
		public void ChangeState(T_ID next)
		{
			if (this.nowStateClass != null)
			{
				this.nowStateClass.Out();
			}
			this.nowStateID = next;
			this.nowStateClass = this.states[this.nowStateID];
			this.nowStateClass.In();
		}

		// Token: 0x04001CBE RID: 7358
		protected Dictionary<T_ID, T_CLASS> states = new Dictionary<T_ID, T_CLASS>();

		// Token: 0x04001CBF RID: 7359
		protected T_ID nowStateID;

		// Token: 0x04001CC0 RID: 7360
		protected T_CLASS nowStateClass;
	}
}
